<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        /*
        在当前作用阈下，不管条件是否成立，都要进行变量提升
        */
        console.log(b) //undefined
        if ('b' in window) {
            var b = 100
        }
        console.log(b) //100


        console.log(a) //undefined
        if (1 < 2) {
            var a = 10
        }
        console.log(a) //10
    </script>
</body>

</html>